package cn.domob.android.ads;

import android.app.Activity;
import android.net.Uri;
import android.util.Log;
import android.widget.FrameLayout.LayoutParams;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import org.json.JSONObject;
import org.json.JSONTokener;

class A extends i
  implements D.a
{
  private static J B = new J(A.class.getSimpleName());
  private static final String C = "addAsset";
  private static final String D = "addAssets";

  public A(DomobAdView paramDomobAdView, String paramString)
  {
    super(paramDomobAdView, paramString);
    B.b("Init Splash controller.");
  }

  public void a(H paramH)
  {
    B.b("All resources are replaced. Show Splash.");
    ((B)this.c).n();
  }

  public void a(l paraml, int paramInt)
  {
    B.a("An ad response is received by splash controller.");
    if (paraml != null)
    {
      if (paramInt == -1)
      {
        B.a("There is a cached ad witch is about to be show.");
        super.a(paraml, paramInt);
      }
      do
      {
        return;
        if (paraml.d() == null)
          continue;
        String str1 = paraml.d().f();
        String str2;
        if ((str1 != null) && (str1.length() != 0) && (str1.equals("url")))
        {
          p localp = new p(this.a, paraml.d().e(), null);
          localp.c();
          str2 = localp.e();
          if ((str2 == null) || (str2.length() == 0))
            break label381;
        }
        try
        {
          B.a("Download content from ad url:" + str2);
          JSONObject localJSONObject1 = new JSONObject(new JSONTokener(paraml.a()));
          JSONObject localJSONObject2 = localJSONObject1.optJSONObject("ad");
          if (localJSONObject2 != null)
          {
            localJSONObject2.put("ct", "content");
            localJSONObject2.put("content", str2);
          }
          String str3 = localJSONObject1.toString();
          B.a("Modified ad response after downloading ad content: " + str3);
          l locall = l.a(str3);
          paraml = locall;
          B.a("There is a new ad witch is about to be inserted into DB.");
          ae localae = new ae();
          localae.b(paraml.d().a());
          localae.d(paraml.d().c() + "*" + paraml.d().d());
          localae.c(paraml.a());
          localae.a(paraml.d().s());
          localae.b(System.currentTimeMillis());
          new g().a(this.a, localae);
          super.a(paraml, paramInt);
          return;
        }
        catch (Exception localException)
        {
          B.a(localException);
          B.e("Failed to modify response.");
          return;
        }
        label381: B.e("Failed to download creative content. This AD response won't be saved.");
        return;
      }
      while (paraml.e() == null);
      B.e("There is a error info response.");
      Object[] arrayOfObject = new Object[2];
      arrayOfObject[0] = Integer.valueOf(paraml.e().a());
      arrayOfObject[1] = paraml.e().b();
      Log.e("DomobSDK", String.format("Response contains error info. Error code is [%d] and error content is [%s]", arrayOfObject));
      return;
    }
    super.a(paraml, paramInt);
  }

  protected void a(l paraml, String paramString)
  {
    B.b("Failed to splash.Report fail event type " + paramString);
    z localz = new z(this.a);
    z.c localc;
    String str;
    if ((paraml != null) && (paraml.d() != null))
    {
      localz.getClass();
      localc = new z.c(localz);
      str = paraml.d().l();
      localc.a = paraml.d().m();
    }
    while (true)
    {
      if ((str == null) || (str.length() == 0))
        str = "http://e.domob.cn/event_report";
      localz.a(str, z.h.i, paramString, localc, null);
      return;
      str = null;
      localc = null;
    }
  }

  protected void z()
  {
    ((Activity)this.a).runOnUiThread(new Runnable()
    {
      public void run()
      {
        A.H().b("Start to load Splash Ad page.");
        l.b localb = A.this.d.d();
        int i = (int)(localb.c() * q.u(A.this.a));
        int j = (int)(localb.d() * q.u(A.this.a));
        A.this.c.a(i, j);
        A.this.f = new C(A.this.a);
        D localD = (D)A.this.f.a();
        A.H().a("Background WebView is:" + localD.d());
        localD.setLayoutParams(new FrameLayout.LayoutParams(i, j));
        localD.a(new c.a()
        {
          public void a(c paramc, String paramString)
          {
            A.H().a("Splash DomobWebView 拦截到:" + paramString);
            D localD = (D)paramc;
            if (paramString.startsWith("domob"))
            {
              Uri localUri = Uri.parse(paramString);
              if ("domob".equals(localUri.getScheme()))
              {
                String str1 = localUri.getHost();
                if (str1.equals("addAsset"))
                {
                  A.H().b("JS function 'addAsset' is called.");
                  HashMap localHashMap2 = F.a(localUri.getQuery());
                  Iterator localIterator2 = localHashMap2.keySet().iterator();
                  while (localIterator2.hasNext())
                  {
                    String str5 = (String)localIterator2.next();
                    J localJ2 = A.H();
                    Object[] arrayOfObject2 = new Object[2];
                    arrayOfObject2[0] = str5;
                    arrayOfObject2[1] = localHashMap2.get(str5);
                    localJ2.b(String.format("param: %s=%s", arrayOfObject2));
                  }
                  if (localHashMap2.size() == 2)
                  {
                    String str3 = (String)localHashMap2.get("url");
                    String str4 = (String)localHashMap2.get("alias");
                    A.H().b(String.format("url=%s, alias=%s", new Object[] { str3, str4 }));
                    localD.a(str3, str4, A.this.d.d().a());
                  }
                  return;
                }
                if (str1.equals("addAssets"))
                {
                  A.H().b("JS function 'addAssets' is called.");
                  HashMap localHashMap1 = F.a(localUri.getQuery());
                  Iterator localIterator1 = localHashMap1.keySet().iterator();
                  while (true)
                  {
                    if (localIterator1.hasNext());
                    String str2 = (String)localIterator1.next();
                    J localJ1 = A.H();
                    Object[] arrayOfObject1 = new Object[2];
                    arrayOfObject1[0] = str2;
                    arrayOfObject1[1] = localHashMap1.get(str2);
                    localJ1.b(String.format("param: %s=%s", arrayOfObject1));
                    localD.a((String)localHashMap1.get(str2), str2, A.this.d.d().a());
                  }
                }
              }
            }
            A.this.a(paramc, paramString, true);
          }
        });
        localD.a(A.this.d.d().g(), A.this.d.d().h(), A.this.d.d().v(), A.this);
        A.this.a(A.this.f);
      }
    });
  }
}

/* Location:           C:\Users\god\Desktop\liunianjishiben_V1.1_mumayi_3745b_dex2jar.jar
 * Qualified Name:     cn.domob.android.ads.A
 * JD-Core Version:    0.5.4
 */